/**
 * File  : WorkThreads.h
 * Time  : 2014-12-22 09:58
 * Author: KashingLee
 * Ref   : Null
 */
#ifndef PLCC_WORK_THREAD_H_
#define PLCC_WORK_THREAD_H_
#include <string>
#include <unistd.h>
#include <errno.h>
#include "./thread/Thread.h"
#include "./event_queue/EventQueue.h"
#include "./play/play_data.h"
#include "./thread/Mutex.h"
#include <iostream>
#include "./log/log.h"
//using std::string;


template <class Element1,class Element2,class Element3>
class WorkThread: public Thread {
 public:
  void set_event_queue(EventQueue<Element1> *event_queue,\
                      EventQueue<Element2>  *ack_queue ,
                      EventQueue<Element3>  *log_queue) {
    event_queue_ = event_queue;
    ack_queue_   = ack_queue;
    log_queue_   = log_queue; 
  }
/*
  void set_event_queue(EventQueue<Element1> *log_queue) {
    log_queue_=log_queue;
  }*/

 protected:
  EventQueue<Element1> *event_queue_;
  EventQueue<Element2> *ack_queue_;
  EventQueue<Element3> *log_queue_;
	Mutex mutex_;
};

class PlayThread: public WorkThread<play_data,uint32_t,LogType> {
  virtual void Run ();
	private:
			int xmldecoder();
};

class SettingThread: public WorkThread<uint32_t,uint32_t,LogType> {
  virtual void Run (); 
	
};

class CheckThread: public WorkThread<uint32_t,uint32_t,LogType> {
  virtual void Run (); 
};

class UpdateThread: public WorkThread<uint32_t,uint32_t,LogType> {
  virtual void Run (); 
};

class NetThread: public WorkThread<play_data,uint32_t,LogType> {
 public:
  virtual void Run (); 
	
};

class LogThread: public WorkThread<LogType,LogType,LogType> {
  virtual void Run (); 
};

#endif  //PLCC_WORK_THREAD_H_

